<template>
	<view>
		<my-status-bar />
		<view class="p-10">
			<template v-for="(item, index) in appCategoryList" :index="index">
				<applicationItem v-bind="item" :appList="item.appList" />
			</template>
		</view>
	</view>
</template>

<script setup>
	import { hseMsg, sbsmzqMsg, rydwMsg } from '@/hooks/msg.js'
	import applicationItem from './application-item.vue';

	const appCategoryList = ref([{
			title: '应用中心',
			has: [],
			appList: [{
					name: 'HSE',
					path: '/pages/appPages/appPages',
					icon: 'index/hse.svg',
					address: 'https://www.xjnyjtsthgs.com:38087/xjsthhse/web/BCBS04',
					has: [],
					// has: ['中层以上', 'HSE']
				}, {
					name: '设备全生命周期',
					path: '/pages/appPages/appPages',
					icon: 'index/sbsmzq.svg',
					address: 'https://www.xjnyjtsthgs.com:39400',
					has: []
					// has: ['中层以上', '设备全生命周期']
				}, {
					name: '人员定位',
					path: '/pages/appPages/appPages',
					icon: 'index/rydw.svg',
					address: 'https://www.xjnyjtsthgs.com:51104/rydwapp/',
					has: []
					// has: ['中层以上', '人员定位'],
				},
				{
					name: '矿山设计',
					path: '/pages/appPages/appPages',
					icon: 'index/kssj.svg',
					address: 'https://www.xjnyjtsthgs.com:42099/mes-h5/#/views/home/index',
					has: ['中层以上', '矿山设计']
				}
			]
		},
		{
			title: '生产管控中心',
			has: [],
			appList: [{
				name: '产运销',
				path: '/pages/application/xxjc/cyx/index',
				icon: 'work/scdd.png',
				has: ['中层以上']
			}, {
				name: '地质保障',
				path: '/pages/application/kssj/geology/index',
				icon: 'work/dzbz.png',
				has: []
			}, {
				name: '智能穿爆',
				path: '/pages/application/zncb/burst/index',
				icon: 'work/zncb.png',
				has: []
			}, {
				name: '穿孔爆破',
				path: '/pages/application/kssj/ckbp/index',
				icon: 'work/ckbp.png',
				has: []
			}, {
				name: '采矿设计',
				path: '/pages/application/kssj/mining/index',
				icon: 'work/cksj.png',
				has: []
			}, {
				name: '间断工艺',
				path: '/pages/application/ksgc/vehicle/index',
				icon: 'work/jdgy.png',
				has: []
			}, {
				name: '半连续工艺',
				path: '/pages/application/ksgc/blxgy/index',
				icon: 'work/blxgy.png',
				has: []
			}]
		}, {
			title: '安全管控中心',
			has: [],
			appList: [{
				name: '视频监控',
				path: '/pages/application/xxjc/spjk/index',
				icon: 'work/spjk.png',
				has: ['中层以上']
			}, {
				name: '应急调度',
				path: '/pages/application/xxjc/yjdd/index',
				icon: 'work/yjdd.png',
				has: ['中层以上']
			}, {
				name: '火灾监测',
				path: '/pages/application/znfz/fireMonitoring/index',
				icon: 'work/hzjc.png',
				has: []
			}, {
				name: '环境监测',
				path: '/pages/application/znfz/hjjc/index',
				icon: 'work/hjjc.png',
				has: []
			}, {
				name: '防排水',
				path: '/pages/application/znfz/fps/index',
				icon: 'work/fps.png',
				has: []
			}, {
				name: '水害监测',
				path: '/pages/application/znfz/shjc/index',
				icon: 'work/shjc.png',
				has: []
			}]
		}, {
			title: '智能辅助中心',
			has: [],
			appList: [{
				name: '能耗精细化',
				path: '/pages/application/znfz/nhjxh/index',
				icon: 'index/nhjxh.svg',
				has: []
			}, {
				name: '供配电',
				path: '/pages/application/znfz/electric/index',
				icon: 'work/gpd.png',
				has: []
			}, {
				name: '设备巡检',
				path: '/pages/application/znfz/sbxj/index',
				icon: 'work/sbxj.png',
				has: []
			}, {
				name: '风险隐患排查',
				path: '/pages/application/znfz/aqxj/index',
				icon: 'work/aqjc.png',
				has: []
			}]
		}, {
			title: '决策支持中心',
			has: ['中层以上'],
			appList: [{
				name: '生产信息',
				path: '/pages/application/znyq/scxx/index',
				icon: 'work/aqjc.png',
				has: ['中层以上']
			}, {
				name: '经营信息',
				path: '/pages/application/znyq/businessDecision/index',
				icon: 'work/scjc.png',
				has: ['中层以上']
			}, {
				name: '决策支持',
				path: '/pages/application/znyq/jczc/index',
				icon: 'work/jczc.png',
				has: ['中层以上']
			}, {
				name: '智慧园区',
				path: '/pages/application/znyq/intelligentPark/index',
				icon: 'work/zhyq.png',
				has: ['中层以上']
			}]
		}, {
			title: '信息基础平台',
			has: [],
			appList: [{
				name: '通信网络',
				path: '/pages/application/xxjc/network/index',
				icon: 'work/txwl.png',
				has: []
			}, {
				name: '数据中心',
				path: '/pages/application/xxjc/sjzx/index',
				icon: 'work/sjzx.png',
				has: []
			}]
		},
	]);

	onShow(() => {
		hseMsg().then(res => {
			const total = res.data.activeTodoNumber * 1 + res.data.hiddenTodoNumber * 1 + res.data
				.ticketTodoNumber * 1

			appCategoryList.value[0].appList[0].badge = total;
		})
		sbsmzqMsg().then(res => {
			appCategoryList.value[0].appList[1].badge = res.data;
		})
		rydwMsg().then(res => {
			appCategoryList.value[0].appList[2].badge = res.data;
		})
	});
</script>